//
//  ProCitySelect.m
//  
//
//  Created by dlios on 15/5/26.
//
//

#import "ProCitySelect.h"

@implementation ProCitySelect

+ (NSArray *)selectCity {
    NSMutableArray *rotarray = [NSMutableArray array];
    NSString *string = [[NSBundle mainBundle] pathForResource:@"CityDB" ofType:@"json"];
    NSData *data = [NSData dataWithContentsOfFile:string];
   NSArray *array = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
    for (NSDictionary *dic in array) {
        CityDBModel *model = [CityDBModel getCityDBModel];
        model.cityId = [dic objectForKey:@"cityId"];
        model.cityName = [dic objectForKey:@"cityName"];
        model.letter = [dic objectForKey:@"letter"];
        model.proId = [dic objectForKey:@"proId"];
        [rotarray addObject:model];
    }
    return rotarray;
}

+ (NSArray *)selectProvince {
    NSMutableArray *rotarray = [NSMutableArray array];
    NSString *string = [[NSBundle mainBundle] pathForResource:@"ProvinceDB" ofType:@"json"];
    NSData *data = [NSData dataWithContentsOfFile:string];
    NSArray *arrray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
    for (NSDictionary *dic in arrray) {
        ProvinceDBModel *model = [ProvinceDBModel getProvinceDBModel];
        model.proid = [dic objectForKey:@"proId"];
        model.proName = [dic objectForKey:@"proName"];
        model.letter = [dic objectForKey:@"letter"];
        [rotarray addObject:model];
    }
    return rotarray;
}

@end
